<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">

          <a-col :md="4" :sm="6">
            <a-form-item :label=" $t('base.code') ">
              <j-input :placeholder=" $t('base.inputVagueQuery') " v-model="queryParam.code"></j-input>
            </a-form-item>
          </a-col>

          <a-col :md="4" :sm="6">
            <a-form-item :label=" $t('base.name') ">
              <j-input :placeholder="$t('base.inputVagueQuery')" v-model="queryParam.name"></j-input>
            </a-form-item>
          </a-col>

          <a-col :md="6" :sm="8">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search"> {{$t('base.query')}} </a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px"> {{$t('base.reset')}} </a-button>
            </span>
          </a-col>

        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->
    
    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus"> {{$t('base.add')}} </a-button>
      <a-button @click="batchDel" type="primary" icon="delete"> {{$t('base.del')}} </a-button>
    </div>

    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> {{$t('base.selected')}} <a style="font-weight: 600">{{ selectedRowKeys.length }}</a> {{$t('base.item')}}
        <a style="margin-left: 24px" @click="onClearSelected"> {{$t('base.clear')}} </a>
      </div>

      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{fixed:true,selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        
        @change="handleTableChange">
        <template slot="avatarslot" slot-scope="text, record, index">
          <div class="anty-img-wrap">
            <img :src="getAvatarView(record.status)"/>
          </div>
        </template>
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)"> {{$t('base.edit')}} </a>

          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link"> {{$t('base.more')}} <a-icon type="down" /></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a-popconfirm :title="$t('base.confirmDelete')" @confirm="() => handleDelete(record.id)">
                  <a> <a-icon type="delete" /> {{$t('base.del')}} </a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>

      </a-table>
    </div>

    <glrRadioServer-modal ref="modalForm" @ok="modalFormOk"></glrRadioServer-modal>
  </a-card>
</template>

<script>

  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import GlrRadioServerModal from './modules/GlrRadioServerModal'
  import JInput from '@/components/jeecg/JInput'
  import { httpAction } from '@/api/manage'
  import JDictSelectTag from '@/components/dict/JDictSelectTag'
  export default {
    name: "GlrRadioServerList",
    mixins:[JeecgListMixin],
    components: {
      GlrRadioServerModal,
      JDictSelectTag,
      JInput
    },
    data () {
      return {
        description: '音柱管理管理页面',
        imagstr:null,
        sliderstatus:false,
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title: this.$t('base.code') ,
            align:"center",
            dataIndex: 'code'
          },
          {
            title:this.$t('base.name'),
            align:"center",
            dataIndex: 'name'
          },
          {
            title: this.$t('light.ip') ,
            align:"center",
            dataIndex: 'ip'
          },
          {
            title: this.$t('light.port') ,
            align:"center",
            dataIndex: 'port'
          },
          {
            title: this.$t('base.operation'),
            dataIndex: 'action',
            align:"center",
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: "/glr/glrRadioServer/list",
          delete: "/glr/glrRadioServer/delete",
          deleteBatch: "/glr/glrRadioServer/deleteBatch",
          exportXlsUrl: "/glr/glrRadioServer/exportXls",
          importExcelUrl: "glr/glrRadioServer/importExcel",
          setRadioVol: "glr/glrRadioServer/setRadioVol",
        },
        dictOptions:{
        },
      }
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      }

    },
    methods: {
      initDictConfig(){
      },

      getAvatarView: function (status) {
        if(status=='Y'){
          return   require('@/assets/img/zaixian.png');
        }else{
          return   require('@/assets/img/lixian.png');
        }

      },
       
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>